<template>
  <el-row type="flex" justify="center">
    <el-col :span="6" :offset="18">
      <el-form ref="registerForm" :model="registerForm" label-width="80px">
        <el-form-item>
          <span style="font-size:38px">欢迎回来</span>&nbsp;&nbsp;&nbsp;
          <span>
            <span>已有账号？</span>
            <router-link style="color: #409EFF;text-decoration:none" to="/login">去登录</router-link>
          </span>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="registerForm.manageNickName" placeholder="请输入用户名"></el-input>
        </el-form-item>
        <el-form-item label="账号">
          <el-input v-model="registerForm.manageAccount" placeholder="请输入账号"></el-input>
        </el-form-item>
        <el-form-item>
          <el-form-item style="margin-left: -80px" label="密码">
          <el-input v-model="registerForm.managePwd" show-password placeholder="请输入密码"></el-input>
        </el-form-item>
        </el-form-item>
        <el-form-item>
          <el-button @click="register" type="primary" style="width: 100%;">注册</el-button>
        </el-form-item>
      </el-form>
    </el-col>
  </el-row>
</template>
  
  <script>
export default {
  data() {
    return {
      code: "",
      registerForm: {
        manageNickName: "",
        manageAccount: "",
        managePwd: ""
      },
      countdown: 0
    };
  },
  methods: {
    register() {
      if (
        !this.registerForm.manageNickName ||
        !this.registerForm.manageAccount ||
        !this.registerForm.managePwd
      ) {
        this.$message.error("请完整填写注册信息");
        return;
      }
        this.$axios.post("api/uums-server/register", this.registerForm).then(res => {
          if (res.data.code == 200) {
            this.$message({
              message: "注册成功，请登录",
              type: "success"
            });
            this.$router.push({path:"/login"})
          }
        });
      console.log("Registration form:", this.registerForm);
    }
  }
};
</script>
  
  <style scoped>
.el-row {
  background-image: url("../assets/loginbac.jpg");
  background-size: cover;
    height: 100%;
}
.el-col {
  background: white;
  padding: 15% 20px;
  border-radius: 2px;
}
.el-input {
  margin: 8px 1px;
}
</style>